A Constructive Formalization of the Catch and Throw Mechanism
نویسنده
چکیده
The catch/throw mechanism is a programming construct for non-local exit. In the practical programming, this mechanism plays an important role when programmers handle exceptional situations. In this paper we give a constructive formalization which captures the mechanism in the proofs-as-programs notion. We introduce a modi ed version of LJ equipped with inference rules corresponding to the operations of catch and throw. Then we show that we can actually extract programs which make use of the catch/throw mechanism from proofs under a certain realizability interpretation. Although the catch/throw mechanism provides only a restricted access to the current continuation, the formulation remains constructive in contrast to the works due to Gri n and Murthy on more powerful facilities such as call/cc (call-with-current-continuation) of Scheme.
منابع مشابه
A New Formulation of the Catch/Throw Mechanism
The catch/throw mechanism in Common Lisp gives a simple control structure for non-local exits. Nakano[7, 9] and Sato[13] proposed intuitionistic calculi with inference rules which give logical interpretations of the catch/throw-constructs. Although the calculi are theoretically well-founded, we cannot use the catch/throw mechanism for handling run-time errors in a meaningful way, because of the...
متن کاملStrong normalizability of the non-deterministic catch/throw calculi
The catch/throw mechanism in Common Lisp provides a simple control mechanism for non-local exit. We study typed calculi by Nakano and Sato which formalize the catch/throw mechanism. These calculi correspond to classical logic through the Curry-Howard isomorphism, and one of their characteristic points is that they have nondeterministic reduction rules. These calculi can represent various comput...
متن کاملTwo Extensions of Px System (extended Abstract)
Two extensions of PX system will be discussed. The extensions are ctPX (catch/throw PX) and mvPX (multiple values PX). ctPX is a PX system extended with Nakano's catch/throw logic. ctPX enables to extract LISP programs with catch/throw mechanism form natural proofs. mvPX is a PX system which uses multiple values rather than lists to keep a nite sequences of data. Programs extracted by ctPX are ...
متن کاملThe Non-deterministic Catch and Throw Mechanism and Its Subject Reduction Property
A simple programming language and its typing system is introduced to capture the catch and throw mechanism with its nondeterministic feature. The subject reduction property of the system, which compensates for the unpleasant feature of the non-determinism, is shown.
متن کاملCompiling Exceptions Correctly
An exception compilation scheme that dynamically creates and removes exception handler entries on the stack. A formalization of an article of the same name by Hutton and Wright [1]. 1 Compiling exception handling theory Exceptions imports Main begin 1.1 The source language datatype expr = Val int | Add expr expr | Throw | Catch expr expr consts eval :: "expr ⇒ int option" primrec "eval (Val i) ...
متن کامل